
/**
  ******************************************************************************
  * Copyright 2021 The Microbee Authors. All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * 
  * @file       sensor_imu_qmi8658_registers.h
  * @author     baiyang
  * @date       2022-8-4
  ******************************************************************************
  */

#pragma once

#ifdef __cplusplus
extern "C"{
#endif

/*----------------------------------include-----------------------------------*/

/*-----------------------------------macro------------------------------------*/
#define QMI8658C_I2C_ADD            0XD4
/*---------------------GENERAL PURPOSE REGISTERS------------------*/
#define QMI8658_WHOAMI_VAL         0x05
#define QMI8658_REVISION_ID_VAL    0x79    //DEVICE REVISION ID

#define QMI8658C_REGADD_WHO_AM_I    0X00    //DEVICE IDENTIFIER
#define QMI8658C_REGADD_REVISION_ID 0X01    //DEVICE REVISION ID
/*---------------------SETUP AND CONTROL REGISTERS------------------*/
#define QMI8658C_REGADD_CTRL1       0X02    //SPI INTERFACE AND SENSOR ENABLE
#define QMI8658C_REGADD_CTRL2       0X03    //ACCELEROMETER: OUTPUT DATA RATE, FULL SCALE, SELF TEST
#define QMI8658C_REGADD_CTRL3       0X04    //GYROSCOPE: OUTPUT DATA RATE, FULL SCALE, SELF TEST
#define QMI8658C_REGADD_CTRL4       0X05    //MAGNETOMETER SETTINGS: OUTPUT DATA RATE, AND DEVICE SELECTION
#define QMI8658C_REGADD_CTRL5       0X06    //LOW PASS FILTER SETTING.
#define QMI8658C_REGADD_CTRL6       0X07    //ATTITUDEENGINE? SETTINGS: OUTPUT DATA RATE, MOTION ON DEMAND
#define QMI8658C_REGADD_CTRL7       0X08    //ENABLE SENSORS
#define QMI8658C_REGADD_CTRL8       0X09    //RESERVED: NOT USED
#define QMI8658C_REGADD_CTRL9       0X0A    //HOST COMMANDS
/*---------------------HOST CONTROLLED CALIBRATION REGISTERS------------------*/
#define QMI8658C_REGADD_CAL1_L       0X0B    //CALIBRATION REGISTER CAL1_L – LOWER 8 BITS. CAL1_H – UPPER 8 BITS.
#define QMI8658C_REGADD_CAL1_H       0X0C
#define QMI8658C_REGADD_CAL2_L       0X0D    //CALIBRATION REGISTER CAL2_L – LOWER 8 BITS. CAL2_H – UPPER 8 BITS.
#define QMI8658C_REGADD_CAL2_H       0X0E
#define QMI8658C_REGADD_CAL3_L       0X0F    //CALIBRATION REGISTER CAL3_L – LOWER 8 BITS. CAL3_H – UPPER 8 BITS.
#define QMI8658C_REGADD_CAL3_H       0X10
#define QMI8658C_REGADD_CAL4_L       0X11    //CALIBRATION REGISTER CAL4_L – LOWER 8 BITS. CAL4_H – UPPER 8 BITS.
#define QMI8658C_REGADD_CAL4_H       0X12
/*---------------------FIFO REGISTERS------------------*/
#define QMI8658C_REGADD_FIFO_WTM_TH      0X13    //FIFO WATERMARK LEVEL, IN ODRS
#define QMI8658C_REGADD_FIFO_CTRL        0X14    //FIFO SETUP
#define QMI8658C_REGADD_FIFO_SMPL_CNT    0X15    //FIFO SAMPLE COUNT LSBS
#define QMI8658C_REGADD_FIFO_STATUS      0X16    //FIFO STATUS
#define QMI8658C_REGADD_FIFO_DATA        0X17    //FIFO DATA
/*---------------------STATUS REGISTERS------------------*/
#define QMI8658C_REGADD_I2CM_STATUS      0X2C    //I2C MASTER STATUS.
#define QMI8658C_REGADD_STATUSINT        0X2D    //SENSOR DATA AVAILABILITY WITH THE LOCKING MECHANISM.
#define QMI8658C_REGADD_STATUS0          0X2E    //OUTPUT DATA OVER RUN AND DATA AVAILABILITY.
#define QMI8658C_REGADD_STATUS1          0X2F    //MISCELLANEOUS STATUS: WAKE ON MOTION, CMDDONE(CTRL9 PROTOCOL BIT).
/*---------------------TIMESTAMP REGISTER------------------*/
#define QMI8658C_REGADD_TIMESTAMP_LOW    0X30    //SAMPLE TIME STAMP TIMESTAMP_LOW – LOWER 8 BITS.
#define QMI8658C_REGADD_TIMESTAMP_MID    0X31    //TIMESTAMP_MID – MIDDLE 8 BITS.
#define QMI8658C_REGADD_TIMESTAMP_HIGH   0X32    //TIMESTAMP_HIGH – UPPER 8 BITS.
/*---------------------DATA OUTPUT REGISTERS------------------*/
#define QMI8658C_REGADD_TEMP_L      0X33    //TEMPERATURE OUTPUT DATA TEMP_L – LOWER 8 BITS. TEMP_H – UPPER 8 BITS
#define QMI8658C_REGADD_TEMP_H      0X34
#define QMI8658C_REGADD_AX_L        0X35    //X-AXIS ACCELERATION AX_L – LOWER 8 BITS. AX_H – UPPER 8 BITS
#define QMI8658C_REGADD_AX_H        0X36
#define QMI8658C_REGADD_AY_L        0X37    //Y-AXIS ACCELERATION AY_L – LOWER 8 BITS. AY_H – UPPER 8 BITS
#define QMI8658C_REGADD_AY_H        0X38
#define QMI8658C_REGADD_AZ_L        0X39    //Z-AXIS ACCELERATION AZ_L – LOWER 8 BITS. AZ_H – UPPER 8 BITS
#define QMI8658C_REGADD_AZ_H        0X3A
#define QMI8658C_REGADD_GX_L        0X3B    //X-AXIS ANGULAR RATE GX_L – LOWER 8 BITS. GX_H – UPPER 8 BITS
#define QMI8658C_REGADD_GX_H        0X3C
#define QMI8658C_REGADD_GY_L        0X3D    //Y-AXIS ANGULAR RATE GY_L – LOWER 8 BITS. GY_H – UPPER 8 BITS
#define QMI8658C_REGADD_GY_H        0X3E
#define QMI8658C_REGADD_GZ_L        0X3F    //Z-AXIS ANGULAR RATE GZ_L – LOWER 8 BITS. GZ_H – UPPER 8 BITS
#define QMI8658C_REGADD_GZ_H        0X40
#define QMI8658C_REGADD_MX_L        0X41    //X-AXIS MAGNETIC FIELD MX_L – LOWER 8 BITS. MX_H – UPPER 8 BITS
#define QMI8658C_REGADD_MX_H        0X42
#define QMI8658C_REGADD_MY_L        0X43    //Y-AXIS MAGNETIC FIELD MY_L – LOWER 8 BITS. MY_H – UPPER 8 BITS
#define QMI8658C_REGADD_MY_H        0X44
#define QMI8658C_REGADD_MZ_L        0X45    //Z-AXIS MAGNETIC FIELD MZ_L – LOWER 8 BITS. MZ_H – UPPER 8 BITS
#define QMI8658C_REGADD_MZ_H        0X46
#define QMI8658C_REGADD_DQW_L       0X49    //QUATERNION INCREMENT DQW DQW_L – LOWER 8 BITS. DQW_H – UPPER 8 BITS
#define QMI8658C_REGADD_DQW_H       0X4A
#define QMI8658C_REGADD_DQX_L       0X4B    //QUATERNION INCREMENT DQX DQX_L – LOWER 8 BITS. DQX_H – UPPER 8 BITS
#define QMI8658C_REGADD_DQX_H       0X4C
#define QMI8658C_REGADD_DQY_L       0X4D    //QUATERNION INCREMENT DQY DQY_L – LOWER 8 BITS. DQY_H – UPPER 8 BITS
#define QMI8658C_REGADD_DQY_H       0X4E
#define QMI8658C_REGADD_DQZ_L       0X4F    //QUATERNION INCREMENT DQZ DQZ_L – LOWER 8 BITS. DQZ_H – UPPER 8 BITS
#define QMI8658C_REGADD_DQZ_H       0X50
#define QMI8658C_REGADD_DVX_L       0X51    //VELOCITY INCREMENT ALONG X-AXIS DVX_L – LOWER 8 BITS. DVX_H – UPPER 8 BITS
#define QMI8658C_REGADD_DVX_H       0X52
#define QMI8658C_REGADD_DVY_L       0X53    //VELOCITY INCREMENT ALONG Y-AXIS DVY_L – LOWER 8 BITS. DVY_H – UPPER 8 BITS
#define QMI8658C_REGADD_DVY_H       0X54
#define QMI8658C_REGADD_DVZ_L       0X55    //VELOCITY INCREMENT ALONG Z-AXIS DVZ_L – LOWER 8 BITS. DVZ_H – UPPER 8 BITS
#define QMI8658C_REGADD_DVZ_H       0X56
#define QMI8658C_REGADD_AE_REG1     0X57    //ATTITUDEENGINE REGISTER 1
#define QMI8658C_REGADD_AE_REG2     0X58    //ATTITUDEENGINE REGISTER 2
/*---------------------RESET REGISTER------------------*/
#define QMI8658C_REGADD_RESET       0X60    //SOFT RESET REGISTER

#define QMI8658_STATUS1_CMD_DONE            (0x01)
#define QMI8658_STATUS1_WAKEUP_EVENT        (0x04)
/*----------------------------------typedef-----------------------------------*/
enum QMI8658REGISTER
{
    /*! \BRIEF FIS DEVICE IDENTIFIER REGISTER. */
    QMI8658REGISTER_WHOAMI = 0, // 0
    /*! \BRIEF FIS HARDWARE REVISION REGISTER. */
    QMI8658REGISTER_REVISION, // 1
    /*! \BRIEF GENERAL AND POWER MANAGEMENT MODES. */
    QMI8658REGISTER_CTRL1, // 2
    /*! \BRIEF ACCELEROMETER CONTROL. */
    QMI8658REGISTER_CTRL2, // 3
    /*! \BRIEF GYROSCOPE CONTROL. */
    QMI8658REGISTER_CTRL3, // 4
    /*! \BRIEF MAGNETOMETER CONTROL. */
    QMI8658REGISTER_CTRL4, // 5
    /*! \BRIEF DATA PROCESSING SETTINGS. */
    QMI8658REGISTER_CTRL5, // 6
    /*! \BRIEF ATTITUDEENGINE CONTROL. */
    QMI8658REGISTER_CTRL6, // 7
    /*! \BRIEF SENSOR ENABLED STATUS. */
    QMI8658REGISTER_CTRL7, // 8
    /*! \BRIEF RESERVED - DO NOT WRITE. */
    QMI8658REGISTER_CTRL8, // 9
    /*! \BRIEF HOST COMMAND REGISTER. */
    QMI8658REGISTER_CTRL9,    // 10
    /*! \BRIEF CALIBRATION REGISTER 1 MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL1_L = 0x0B,
    /*! \BRIEF CALIBRATION REGISTER 1 LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL1_H,
    /*! \BRIEF CALIBRATION REGISTER 2 MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL2_L,
    /*! \BRIEF CALIBRATION REGISTER 2 LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL2_H,
    /*! \BRIEF CALIBRATION REGISTER 3 MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL3_L,
    /*! \BRIEF CALIBRATION REGISTER 3 LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL3_H,
    /*! \BRIEF CALIBRATION REGISTER 4 MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL4_L,
    /*! \BRIEF CALIBRATION REGISTER 4 LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_CAL4_H,
    /*! \BRIEF FIFO watermark level, in ODRs. */
    QMI8658REGISTER_FIFO_WTM_TH = 0x13,
    /*! \BRIEF FIFO CONTROL REGISTER. */
    QMI8658REGISTER_FIFOCTRL,
    /*! \BRIEF FIFO sample count LSBs. */
    QMI8658REGISTER_FIFO_SMPL_CNT,
    /*! \BRIEF FIFO STATUS REGISTER. */
    QMI8658REGISTER_FIFOSTATUS,    
    /*! \BRIEF FIFO DATA REGISTER. */
    QMI8658REGISTER_FIFODATA,    //
    /*! \BRIEF I2C Master Status. */
    QMI8658REGISTER_I2CM_STATUS = 0x2C,
    /*! \BRIEF OUTPUT DATA OVERRUN AND AVAILABILITY. */
    QMI8658REGISTER_STATUSINT = 0x2D,
    /*! \BRIEF OUTPUT DATA OVERRUN AND AVAILABILITY. */
    QMI8658REGISTER_STATUS0,
    /*! \BRIEF MISCELLANEOUS STATUS REGISTER. */
    QMI8658REGISTER_STATUS1,
    /*! \BRIEF TIMESTAMP LOW. */
    QMI8658REGISTER_TIMESTAMP_L = 0x30,
    /*! \BRIEF TIMESTAMP LOW. */
    QMI8658REGISTER_TIMESTAMP_M,
    /*! \BRIEF TIMESTAMP LOW. */
    QMI8658REGISTER_TIMESTAMP_H,
    /*! \BRIEF TEMPEARTURE LOW. */
    QMI8658REGISTER_TEMPEARTURE_L = 0x33,
    /*! \BRIEF TEMPEARTURE LOW. */
    QMI8658REGISTER_TEMPEARTURE_H,
    /*! \BRIEF ACCELEROMETER X AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_AX_L = 0x35,
    /*! \BRIEF ACCELEROMETER X AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_AX_H,
    /*! \BRIEF ACCELEROMETER Y AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_AY_L,
    /*! \BRIEF ACCELEROMETER Y AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_AY_H,
    /*! \BRIEF ACCELEROMETER Z AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_AZ_L,
    /*! \BRIEF ACCELEROMETER Z AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_AZ_H,
    /*! \BRIEF GYROSCOPE X AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_GX_L = 0x3B,
    /*! \BRIEF GYROSCOPE X AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_GX_H,
    /*! \BRIEF GYROSCOPE Y AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_GY_L,
    /*! \BRIEF GYROSCOPE Y AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_GY_H,
    /*! \BRIEF GYROSCOPE Z AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_GZ_L,
    /*! \BRIEF GYROSCOPE Z AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_GZ_H,
    /*! \BRIEF MAGNETOMETER X AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_MX_L = 0x41,
    /*! \BRIEF MAGNETOMETER X AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_MX_H,
    /*! \BRIEF MAGNETOMETER Y AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_MY_L,
    /*! \BRIEF MAGNETOMETER Y AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_MY_H,
    /*! \BRIEF MAGNETOMETER Z AXIS LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_MZ_L,
    /*! \BRIEF MAGNETOMETER Z AXIS MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_MZ_H,
    /*! \BRIEF QUATERNION INCREMENT W LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q1_L = 0x49,
    /*! \BRIEF QUATERNION INCREMENT W MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q1_H,
    /*! \BRIEF QUATERNION INCREMENT X LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q2_L,
    /*! \BRIEF QUATERNION INCREMENT X MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q2_H,
    /*! \BRIEF QUATERNION INCREMENT Y LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q3_L,
    /*! \BRIEF QUATERNION INCREMENT Y MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q3_H,
    /*! \BRIEF QUATERNION INCREMENT Z LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q4_L,
    /*! \BRIEF QUATERNION INCREMENT Z MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_Q4_H,
    /*! \BRIEF VELOCITY INCREMENT X LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_DVX_L = 0x51,
    /*! \BRIEF VELOCITY INCREMENT X MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_DVX_H,
    /*! \BRIEF VELOCITY INCREMENT Y LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_DVY_L,
    /*! \BRIEF VELOCITY INCREMENT Y MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_DVY_H,
    /*! \BRIEF VELOCITY INCREMENT Z LEAST SIGNIFICANT BYTE. */
    QMI8658REGISTER_DVZ_L,
    /*! \BRIEF VELOCITY INCREMENT Z MOST SIGNIFICANT BYTE. */
    QMI8658REGISTER_DVZ_H,
    /*! \BRIEF ATTITUDEENGINE REG1. */
    QMI8658REGISTER_AEREG1 = 0x57,
    /*! \BRIEF ATTITUDEENGINE REG1. */
    QMI8658REGISTER_AEREG2 = 0x58,

    /*! \BRIEF Soft Reset Register. */
    QMI8658REGISTER_RESET = 0x60,
};

enum QMI8658_OIS_REGISTER
{
    /*-----------------------------*/
    /* SETUP AND CONTROL REGISTERS */
    /*-----------------------------*/
    /*! \BRIEF SPI ENDIAN SELECTION, AND SPI 3/4 WIRE */
    QMI8658_OIS_REG_CTRL1 = 0x02,        // 2  [0X02] -- DFLT: 0X20
    /*! \BRIEF ACCELEROMETER CONTROL: ODR, FULL SCALE, SELF TEST  */
    QMI8658_OIS_REG_CTRL2,                    //  3  [0X03]
    /*! \BRIEF GYROSCOPE CONTROL: ODR, FULL SCALE, SELF TEST */
    QMI8658_OIS_REG_CTRL3,                //  4  [0X04]
    /*! \BRIEF SENSOR DATA PROCESSING SETTINGS */
    QMI8658_OIS_REG_CTRL5    = 0x06,                //  6  [0X06]
    /*! \BRIEF SENSOR ENABLED STATUS: ENABLE SENSORS  */
    QMI8658_OIS_REG_CTRL7   = 0x08,                //  8  [0X08]
    /*-------------------*/
    /* STATUS REGISTERS  */
    /*-------------------*/
    /*! \BRIEF SENSOR DATA AVAILABILITY AND LOCK REGISTER */
    QMI8658_OIS_REG_STATUSINT = 0X2D,            // 45  [0X2D]
    /*! \BRIEF OUTPUT DATA OVERRUN AND AVAILABILITY */
    QMI8658_OIS_REG_STATUS0   = 0X2E,            // 46  [0X2E]

    /*-----------------------------------------------------*/
    /* OIS SENSOR DATA OUTPUT REGISTERS. 16-BIT 2'S COMPLEMENT */
    /*-----------------------------------------------------*/
    /*! \BRIEF ACCELEROMETER X AXIS LEAST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_AX_L  = 0x33,            // 53  [0X35]
    /*! \BRIEF ACCELEROMETER X AXIS MOST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_AX_H,                    // 54  [0X36]
    /*! \BRIEF ACCELEROMETER Y AXIS LEAST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_AY_L,                    // 55  [0X37]
    /*! \BRIEF ACCELEROMETER Y AXIS MOST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_AY_H,                    // 56  [0X38]
    /*! \BRIEF ACCELEROMETER Z AXIS LEAST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_AZ_L,                    // 57  [0X39]
    /*! \BRIEF ACCELEROMETER Z AXIS MOST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_AZ_H,                    // 58  [0X3A]

    /*! \BRIEF GYROSCOPE X AXIS LEAST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_GX_L  = 0x3B,            // 59  [0X3B]
    /*! \BRIEF GYROSCOPE X AXIS MOST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_GX_H,                    // 60  [0X3C]
    /*! \BRIEF GYROSCOPE Y AXIS LEAST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_GY_L,                    // 61  [0X3D]
    /*! \BRIEF GYROSCOPE Y AXIS MOST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_GY_H,                    // 62  [0X3E]
    /*! \BRIEF GYROSCOPE Z AXIS LEAST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_GZ_L,                    // 63  [0X3F]
    /*! \BRIEF GYROSCOPE Z AXIS MOST SIGNIFICANT BYTE */
    QMI8658_OIS_REG_GZ_H,                    // 64  [0X40]
};

enum QMI8658_CTRL9COMMAND
{
    QMI8658_CTRL9_CMD_NOP                    = 0x00,
    QMI8658_CTRL9_CMD_GYROBIAS               = 0x01,
    QMI8658_CTRL9_CMD_RQST_SDI_MOD           = 0x03,
    QMI8658_CTRL9_CMD_RST_FIFO               = 0x04,
    QMI8658_CTRL9_CMD_REQ_FIFO               = 0x05,
    QMI8658_CTRL9_CMD_WOM_SETTING            = 0x08,
    QMI8658_CTRL9_CMD_ACCELHOSTDELTAOFFSET   = 0x09,
    QMI8658_CTRL9_CMD_GYROHOSTDELTAOFFSET    = 0x0A,
    QMI8658_CTRL9_CMD_DBG_WOM_DATA_ENABLE    = 0xF8,

};


enum QMI8658_LPFCONFIG
{
    QMI8658LPF_DISABLE, /*!< \BRIEF DISABLE LOW PASS FILTER. */
    QMI8658LPF_ENABLE   /*!< \BRIEF ENABLE LOW PASS FILTER. */
};

enum QMI8658_HPFCONFIG
{
    QMI8658HPF_DISABLE, /*!< \BRIEF DISABLE HIGH PASS FILTER. */
    QMI8658HPF_ENABLE   /*!< \BRIEF ENABLE HIGH PASS FILTER. */
};

enum QMI8658_STCONFIG
{
    QMI8658ST_DISABLE, /*!< \BRIEF DISABLE HIGH PASS FILTER. */
    QMI8658ST_ENABLE   /*!< \BRIEF ENABLE HIGH PASS FILTER. */
};

enum QMI8658_LPFMODE
{
    A_LSP_MODE_0 = (0x00<<1),
    A_LSP_MODE_1 = (0x01<<1),
    A_LSP_MODE_2 = (0x02<<1),
    A_LSP_MODE_3 = (0x03<<1),
    
    G_LSP_MODE_0 = (0x00<<5),
    G_LSP_MODE_1 = (0x01<<5),
    G_LSP_MODE_2 = (0x02<<5),
    G_LSP_MODE_3 = (0x03<<5)
};

enum QMI8658_ACCRANGE
{
    QMI8658ACCRANGE_2G  = (0x00 << 4), /*!< \BRIEF +/- 2G RANGE */
    QMI8658ACCRANGE_4G  = (0x01 << 4), /*!< \BRIEF +/- 4G RANGE */
    QMI8658ACCRANGE_8G  = (0x02 << 4), /*!< \BRIEF +/- 8G RANGE */
    QMI8658ACCRANGE_16G = (0x03 << 4) /*!< \BRIEF +/- 16G RANGE */
};


enum QMI8658_ACCODR
{
    QMI8658ACCODR_8000HZ  = 0x00,  /*!< \BRIEF HIGH RESOLUTION 8000HZ OUTPUT RATE. */
    QMI8658ACCODR_4000HZ  = 0x01,  /*!< \BRIEF HIGH RESOLUTION 4000HZ OUTPUT RATE. */
    QMI8658ACCODR_2000HZ  = 0x02,  /*!< \BRIEF HIGH RESOLUTION 2000HZ OUTPUT RATE. */
    QMI8658ACCODR_1000HZ  = 0x03,  /*!< \BRIEF HIGH RESOLUTION 1000HZ OUTPUT RATE. */
    QMI8658ACCODR_500HZ   = 0x04,  /*!< \BRIEF HIGH RESOLUTION 500HZ OUTPUT RATE. */
    QMI8658ACCODR_250HZ   = 0x05, /*!< \BRIEF HIGH RESOLUTION 250HZ OUTPUT RATE. */
    QMI8658ACCODR_125HZ   = 0x06, /*!< \BRIEF HIGH RESOLUTION 125HZ OUTPUT RATE. */
    QMI8658ACCODR_62_5HZ  = 0x07, /*!< \BRIEF HIGH RESOLUTION 62.5HZ OUTPUT RATE. */
    QMI8658ACCODR_31_25HZ = 0x08,  /*!< \BRIEF HIGH RESOLUTION 31.25HZ OUTPUT RATE. */
    QMI8658ACCODR_LOWPOWER_128HZ = 0x0C, /*!< \BRIEF LOW POWER 128HZ OUTPUT RATE. */
    QMI8658ACCODR_LOWPOWER_21HZ  = 0x0D,  /*!< \BRIEF LOW POWER 21HZ OUTPUT RATE. */
    QMI8658ACCODR_LOWPOWER_11HZ  = 0x0E,  /*!< \BRIEF LOW POWER 11HZ OUTPUT RATE. */
    QMI8658ACCODR_LOWPOWER_3HZ   = 0x0F    /*!< \BRIEF LOW POWER 3HZ OUTPUT RATE. */
};

enum QMI8658_GYRRANGE
{
    QMI8658GYRRANGE_16DPS    = (0 << 4),   /*!< \BRIEF +-32 DEGREES PER SECOND. */
    QMI8658GYRRANGE_32DPS    = (1 << 4),   /*!< \BRIEF +-32 DEGREES PER SECOND. */
    QMI8658GYRRANGE_64DPS    = (2 << 4),   /*!< \BRIEF +-64 DEGREES PER SECOND. */
    QMI8658GYRRANGE_128DPS   = (3 << 4),  /*!< \BRIEF +-128 DEGREES PER SECOND. */
    QMI8658GYRRANGE_256DPS   = (4 << 4),  /*!< \BRIEF +-256 DEGREES PER SECOND. */
    QMI8658GYRRANGE_512DPS   = (5 << 4),  /*!< \BRIEF +-512 DEGREES PER SECOND. */
    QMI8658GYRRANGE_1024DPS  = (6 << 4), /*!< \BRIEF +-1024 DEGREES PER SECOND. */
    QMI8658GYRRANGE_2048DPS  = (7 << 4), /*!< \BRIEF +-2048 DEGREES PER SECOND. */
};

/*!
 * \BRIEF GYROSCOPE OUTPUT RATE CONFIGURATION.
 */
enum QMI8658_GYRODR
{
    QMI8658GYRODR_8000HZ   = 0x00,  /*!< \BRIEF HIGH RESOLUTION 8000HZ OUTPUT RATE. */
    QMI8658GYRODR_4000HZ   = 0x01,  /*!< \BRIEF HIGH RESOLUTION 4000HZ OUTPUT RATE. */
    QMI8658GYRODR_2000HZ   = 0x02,  /*!< \BRIEF HIGH RESOLUTION 2000HZ OUTPUT RATE. */
    QMI8658GYRODR_1000HZ   = 0x03,    /*!< \BRIEF HIGH RESOLUTION 1000HZ OUTPUT RATE. */
    QMI8658GYRODR_500HZ    = 0x04,    /*!< \BRIEF HIGH RESOLUTION 500HZ OUTPUT RATE. */
    QMI8658GYRODR_250HZ    = 0x05,    /*!< \BRIEF HIGH RESOLUTION 250HZ OUTPUT RATE. */
    QMI8658GYRODR_125HZ    = 0x06,    /*!< \BRIEF HIGH RESOLUTION 125HZ OUTPUT RATE. */
    QMI8658GYRODR_62_5HZ   = 0x07,    /*!< \BRIEF HIGH RESOLUTION 62.5HZ OUTPUT RATE. */
    QMI8658GYRODR_31_25HZ  = 0x08    /*!< \BRIEF HIGH RESOLUTION 31.25HZ OUTPUT RATE. */
};

/** @ 
  * @brief  Attitude Engine ODR and Motion on Demand
  */
enum QMI8658_AEODR
{
    QMI8658AEODR_1HZ   = 0x00,  /*!< \BRIEF 1HZ OUTPUT RATE. */
    QMI8658AEODR_2HZ   = 0x01,  /*!< \BRIEF 2HZ OUTPUT RATE. */
    QMI8658AEODR_4HZ   = 0x02,  /*!< \BRIEF 4HZ OUTPUT RATE. */
    QMI8658AEODR_8HZ   = 0x03,  /*!< \BRIEF 8HZ OUTPUT RATE. */
    QMI8658AEODR_16HZ  = 0x04, /*!< \BRIEF 16HZ OUTPUT RATE. */
    QMI8658AEODR_32HZ  = 0x05, /*!< \BRIEF 32HZ OUTPUT RATE. */
    QMI8658AEODR_64HZ  = 0x06,  /*!< \BRIEF 64HZ OUTPUT RATE. */
    QMI8658AEODR_128HZ = 0x07,  /*!< \BRIEF 128HZ OUTPUT RATE. */
    /*!
     * \BRIEF MOTION ON DEMAND MODE.
     *
     * IN MOTION ON DEMAND MODE THE APPLICATION CAN TRIGGER ATTITUDEENGINE
     * OUTPUT SAMPLES AS NECESSARY. THIS ALLOWS THE ATTITUDEENGINE TO BE
     * SYNCHRONIZED WITH EXTERNAL DATA SOURCES.
     *
     * WHEN IN MOTION ON DEMAND MODE THE APPLICATION SHOULD REQUEST NEW DATA
     * BY CALLING THE QMI8658_REQUESTATTITUDEENGINEDATA() FUNCTION. THE
     * ATTITUDEENGINE WILL RESPOND WITH A DATA READY EVENT (INT2) WHEN THE
     * DATA IS AVAILABLE TO BE READ.
     */
    QMI8658AEODR_MOTIONONDEMAND = 128
};

enum QMI8658_MAGODR
{
    QMI8658MAGODR_1000HZ  = 0x00,   /*!< \BRIEF 1000HZ OUTPUT RATE. */
    QMI8658MAGODR_500HZ   = 0x01,    /*!< \BRIEF 500HZ OUTPUT RATE. */
    QMI8658MAGODR_250HZ   = 0x02,    /*!< \BRIEF 250HZ OUTPUT RATE. */
    QMI8658MAGODR_125HZ   = 0x03,    /*!< \BRIEF 125HZ OUTPUT RATE. */
    QMI8658MAGODR_62_5HZ  = 0x04,    /*!< \BRIEF 62.5HZ OUTPUT RATE. */
    QMI8658MAGODR_31_25HZ = 0x05    /*!< \BRIEF 31.25HZ OUTPUT RATE. */
};
    
enum QMI8658_MAGDEV
{
    MAGDEV_AKM09918 = (0 << 3), /*!< \BRIEF AKM09918. */
};

enum QMI8658_ACCUNIT
{
    QMI8658ACCUNIT_G,  /*!< \BRIEF ACCELEROMETER OUTPUT IN TERMS OF G (9.81M/S^2). */
    QMI8658ACCUNIT_MS2 /*!< \BRIEF ACCELEROMETER OUTPUT IN TERMS OF M/S^2. */
};

enum QMI8658_GYRUNIT
{
    QMI8658GYRUNIT_DPS, /*!< \BRIEF GYROSCOPE OUTPUT IN DEGREES/S. */
    QMI8658GYRUNIT_RADS /*!< \BRIEF GYROSCOPE OUTPUT IN RAD/S. */
};

enum QMI8658_STATUS0
{
    QMI8658STATUS0_ADA = (0x01 << 0), /*!< \BRIEF Accelerometer new data available*/
    QMI8658STATUS0_GDA = (0x01 << 1), /*!< \BRIEF Gyroscope new data available*/
    QMI8658STATUS0_SDA = (0x01 << 3), /*!< \BRIEF AE new data available*/
};

/*----------------------------------variable----------------------------------*/

/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/

/*------------------------------------test------------------------------------*/

#ifdef __cplusplus
}
#endif



